﻿Ext
		.define(
				"Lia.view.ListCar",
				{
					extend : "Ext.dataview.List",
					id : 'ListCar',
					alias : "widget.listcarview",
					// xtype : 'list',
					config : {
						// ui : 'round',
						plugins : [
								{
									xclass : 'Ext.plugin.ListPaging',
									loadMoreText : 'Pr&#243;ximos...',
									autoPaging : true
								},
								{
									xclass : 'Ext.plugin.PullRefresh',
									pullRefreshText : 'Recargar Consulta...',
									releaseRefreshText : 'Soltar para Actualizar...',
									loadingText : 'Cargando...',
									itemId : 'pullRefreshCar',
									id : 'pullRefreshCar',
									refreshFn : function(plugin) {
										Ext.getStore('StoreCar').currentPage = 1;
										Ext.getStore('StoreCar').on('load',
												plugin.processComplete, plugin,
												{
													single : true
												});
										// this.parent._store.removeAll();

										Ext.getStore('StoreCar').load({
											start : 0,
											limit : 10,
											page : 1
										});
									},
									pullTpl : new Ext.XTemplate(
											'<div class="x-list-pullrefresh">',
											'<div class="x-list-pullrefresh-arrow"></div>',
											Ext.LoadingSpinner,
											'<div class="x-list-pullrefresh-wrap">',
											'<h3 class="x-list-pullrefresh-message">{message}</h3>',
											'<div class="x-list-pullrefresh-updated">Ultima Actualizaci&#243;n: <span>{lastUpdated:date("d/m/Y h:iA")}</span></div>',
											'</div>', '</div>')
								} ],
						itemTpl : "<div class='contact'>{modelo} <strong>${precioFormat}</strong> {color}  <a href='http://maps.google.com/maps?daddr={adress}' target='_blank'><img border=0 src='http://www.ggvetrx.com/iphone/thumbs/maps.png'></a></div>",
						store : 'StoreCar',
						grouped : true,
						id : "carsList",
						emptyText : '<div style="margin-top: 20px; text-align: center">No tiene elementos</div>',
						disableSelection : false,
						onItemDisclosure : true,
						items : [ {
							xtype : 'toolbar',
							docked : 'top',
							items : [ {
								xtype : "button",
								ui : "back",
								text : "Volver",
								itemId : "backButtonList",
								id : "backButtonList"
							} ]
						} ]
					}
				});
